1 Imports System.Data.SqlClient
2 Imports Excel = Microsoft.Office.Interop.Excel
3 Public Class frmPartialDueList
4 Sub fillSession()
5 Try
6 con = New SqlConnection(cs)
7 con.Open()
8 adp = New SqlDataAdapter()
9 adp.SelectCommand = New SqlCommand("SELECT distinct (Session) FROM CourseFeepayment", con)
10 ds = New DataSet("ds")
11 adp.Fill(ds)
12 dtable = ds.Tables(0)
13 cmbSession.Items.Clear()
14 For Each drow As DataRow In dtable.Rows
15 cmbSession.Items.Add(drow(0).ToString())
16 Next
17 Catch ex As Exception
18 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
19 End Try
20 End Sub
21 Sub fillSession1()
22 Try
23 con = New SqlConnection(cs)
24 con.Open()
25 adp = New SqlDataAdapter()
26 adp.SelectCommand = New SqlCommand("SELECT distinct (Session) FROM HostelFeepayment", con)
27 ds = New DataSet("ds")
28 adp.Fill(ds)
29 dtable = ds.Tables(0)
30 cmbSession1.Items.Clear()
31 For Each drow As DataRow In dtable.Rows
32 cmbSession1.Items.Add(drow(0).ToString())
33 Next
34 Catch ex As Exception
35 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
36 End Try
37 End Sub
38 Sub fillSession2()
39 Try
40 con = New SqlConnection(cs)
41 con.Open()
42 adp = New SqlDataAdapter()
43 adp.SelectCommand = New SqlCommand("SELECT distinct (Session) FROM BusFeepayment_Student", con)
44 ds = New DataSet("ds")
45 adp.Fill(ds)
46 dtable = ds.Tables(0)
47 cmbSession2.Items.Clear()
48 For Each drow As DataRow In dtable.Rows
49 cmbSession2.Items.Add(drow(0).ToString())
50 Next
51 Catch ex As Exception
52 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
53 End Try
54 End Sub
55 Private Sub cmbSession_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbSession.SelectedIndexChanged
56 Try
57 cmbClass.Enabled = True
58 con = New SqlConnection(cs)
59 con.Open()
60 Dim ct As String = "SELECT distinct RTRIM(Class) FROM CourseFeePayment where CourseFeePayment.Session=@d1"
61 cmd = New SqlCommand(ct)
62 cmd.Connection = con
63 cmd.Parameters.AddWithValue("@d1", cmbSession.Text)
64 rdr = cmd.ExecuteReader()
65 cmbClass.Items.Clear()
66 While rdr.Read
67 cmbClass.Items.Add(rdr(0))
68 End While
69 con.Close()
70 Catch ex As Exception
71 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
72 End Try
73 End Sub
74
75 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
76 Try
77 If Len(Trim(cmbSession.Text)) = 0 Then
78 MessageBox.Show("Please select session", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
79 cmbSession.Focus()
80 Exit Sub
81 End If
82 If Len(Trim(cmbClass.Text)) = 0 Then
83 MessageBox.Show("Please select class", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
84 cmbClass.Focus()
85 Exit Sub
86 End If
87 If Len(Trim(cmbSemester.Text)) = 0 Then
88 MessageBox.Show("Please select semester", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
89 cmbSemester.Focus()
90 Exit Sub
91 End If
92 con = New SqlConnection(cs)
93 con.Open()
94 cmd = New SqlCommand("SELECT RTRIM(Student.AdmissionNo),RTRIM(GRNo),RTRIM(StudentName),RTRIM(SchoolName),RTRIM(PaymentDue) from Student,CourseFeePayment,SchoolInfo where Student.AdmissionNo=CourseFeePayment.AdmissionNo and Student.SchoolID=SchoolInfo.S_ID and CourseFeePayment.Session=@d1 and CourseFeePayment.Class=@d2 and Semester=@d3 and PaymentDue > 0 order by StudentName", con)
95 cmd.Parameters.AddWithValue("@d1", cmbSession.Text)
96 cmd.Parameters.AddWithValue("@d2", cmbClass.Text)
97 cmd.Parameters.AddWithValue("@d3", cmbSemester.Text)
98 rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
99 dgw.Rows.Clear()
100 While (rdr.Read() = True)
101 dgw.Rows.Add(rdr(0), rdr(1), rdr(2), rdr(3), rdr(4))
102 End While
103 con.Close()
104 Catch ex As Exception
105 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
106 End Try
107 End Sub
108
109 Private Sub cmbClass_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbClass.SelectedIndexChanged
110 cmbSemester.Enabled = True
111 End Sub
112
113 Private Sub btnReset_Click(sender As System.Object, e As System.EventArgs) Handles btnReset.Click
114 cmbSession.SelectedIndex = -1
115 cmbClass.SelectedIndex = -1
116 cmbSemester.SelectedIndex = -1
117 cmbSemester.Enabled = False
118 cmbClass.Enabled = False
119 dgw.Rows.Clear()
120 End Sub
121
122 Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
123 Dim rowsTotal, colsTotal As Short
124 Dim I, j, iC As Short
125 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
126 Dim xlApp As New Excel.Application
127 Try
128 Dim excelBook As Excel.Workbook = xlApp.Workbooks.Add
129 Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1), Excel.Worksheet)
130 xlApp.Visible = True
131
132 rowsTotal = dgw.RowCount
133 colsTotal = dgw.Columns.Count - 1
134 With excelWorksheet
135 .Cells.Select()
136 .Cells.Delete()
137 For iC = 0 To colsTotal
138 .Cells(1, iC + 1).Value = dgw.Columns(iC).HeaderText
139 Next
140 For I = 0 To rowsTotal - 1
141 For j = 0 To colsTotal
142 .Cells(I + 2, j + 1).value = dgw.Rows(I).Cells(j).Value
143 Next j
144 Next I
145 .Rows("1:1").Font.FontStyle = "Bold"
146 .Rows("1:1").Font.Size = 12
147
148 .Cells.Columns.AutoFit()
149 .Cells.Select()
150 .Cells.EntireColumn.AutoFit()
151 .Cells(1, 1).Select()
152 End With
153 Catch ex As Exception
154 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
155 Finally
156 'RELEASE ALLOACTED RESOURCES
157 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
158 xlApp = Nothing
159 End Try
160 End Sub
161 Sub Reset()
162 cmbSession.SelectedIndex = -1
163 cmbClass.SelectedIndex = -1
164 cmbSemester.SelectedIndex = -1
165 cmbSemester.Enabled = False
166 cmbClass.Enabled = False
167 dgw.Rows.Clear()
168 cmbSession1.SelectedIndex = -1
169 cmbClass1.SelectedIndex = -1
170 cmbInstallment.SelectedIndex = -1
171 cmbClass1.Enabled = False
172 cmbInstallment.Enabled = False
173 dgw1.Rows.Clear()
174 cmbSession2.SelectedIndex = -1
175 cmbClass2.SelectedIndex = -1
176 cmbInstallment1.SelectedIndex = -1
177 cmbInstallment1.Enabled = False
178 cmbClass2.Enabled = False
179 dgw2.Rows.Clear()
180 fillSession()
181 fillSession1()
182 fillSession2()
183 End Sub
184
185 Private Sub btnClose_Click(sender As System.Object, e As System.EventArgs) Handles btnClose.Click
186 Me.Close()
187 End Sub
188
189 Private Sub frmPartialDueList_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
190 fillSession()
191 fillSession1()
192 fillSession2()
193 End Sub
194
195 Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
196 cmbSession1.SelectedIndex = -1
197 cmbClass1.SelectedIndex = -1
198 cmbInstallment.SelectedIndex = -1
199 cmbClass1.Enabled = False
200 cmbInstallment.Enabled = False
201 dgw1.Rows.Clear()
202 End Sub
203
204 Private Sub Button10_Click(sender As System.Object, e As System.EventArgs) Handles Button10.Click
205 cmbSession2.SelectedIndex = -1
206 cmbClass2.SelectedIndex = -1
207 cmbInstallment1.SelectedIndex = -1
208 cmbInstallment1.Enabled = False
209 cmbClass2.Enabled = False
210 dgw2.Rows.Clear()
211 End Sub
212
213 Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles Button9.Click
214 Dim rowsTotal, colsTotal As Short
215 Dim I, j, iC As Short
216 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
217 Dim xlApp As New Excel.Application
218 Try
219 Dim excelBook As Excel.Workbook = xlApp.Workbooks.Add
220 Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1), Excel.Worksheet)
221 xlApp.Visible = True
222
223 rowsTotal = dgw2.RowCount
224 colsTotal = dgw2.Columns.Count - 1
225 With excelWorksheet
226 .Cells.Select()
227 .Cells.Delete()
228 For iC = 0 To colsTotal
229 .Cells(1, iC + 1).Value = dgw2.Columns(iC).HeaderText
230 Next
231 For I = 0 To rowsTotal - 1
232 For j = 0 To colsTotal
233 .Cells(I + 2, j + 1).value = dgw2.Rows(I).Cells(j).Value
234 Next j
235 Next I
236 .Rows("1:1").Font.FontStyle = "Bold"
237 .Rows("1:1").Font.Size = 12
238
239 .Cells.Columns.AutoFit()
240 .Cells.Select()
241 .Cells.EntireColumn.AutoFit()
242 .Cells(1, 1).Select()
243 End With
244 Catch ex As Exception
245 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
246 Finally
247 'RELEASE ALLOACTED RESOURCES
248 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
249 xlApp = Nothing
250 End Try
251 End Sub
252
253 Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
254 Dim rowsTotal, colsTotal As Short
255 Dim I, j, iC As Short
256 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
257 Dim xlApp As New Excel.Application
258 Try
259 Dim excelBook As Excel.Workbook = xlApp.Workbooks.Add
260 Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1), Excel.Worksheet)
261 xlApp.Visible = True
262
263 rowsTotal = dgw1.RowCount
264 colsTotal = dgw1.Columns.Count - 1
265 With excelWorksheet
266 .Cells.Select()
267 .Cells.Delete()
268 For iC = 0 To colsTotal
269 .Cells(1, iC + 1).Value = dgw1.Columns(iC).HeaderText
270 Next
271 For I = 0 To rowsTotal - 1
272 For j = 0 To colsTotal
273 .Cells(I + 2, j + 1).value = dgw1.Rows(I).Cells(j).Value
274 Next j
275 Next I
276 .Rows("1:1").Font.FontStyle = "Bold"
277 .Rows("1:1").Font.Size = 12
278
279 .Cells.Columns.AutoFit()
280 .Cells.Select()
281 .Cells.EntireColumn.AutoFit()
282 .Cells(1, 1).Select()
283 End With
284 Catch ex As Exception
285 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
286 Finally
287 'RELEASE ALLOACTED RESOURCES
288 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
289 xlApp = Nothing
290 End Try
291 End Sub
292
293 Private Sub cmbSession1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbSession1.SelectedIndexChanged
294 Try
295 cmbClass1.Enabled = True
296 con = New SqlConnection(cs)
297 con.Open()
298 Dim ct As String = "SELECT distinct RTRIM(Class) FROM HostelFeePayment where Session=@d1"
299 cmd = New SqlCommand(ct)
300 cmd.Connection = con
301 cmd.Parameters.AddWithValue("@d1", cmbSession1.Text)
302 rdr = cmd.ExecuteReader()
303 cmbClass1.Items.Clear()
304 While rdr.Read
305 cmbClass1.Items.Add(rdr(0))
306 End While
307 con.Close()
308 Catch ex As Exception
309 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
310 End Try
311 End Sub
312
313 Private Sub cmbSession2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbSession2.SelectedIndexChanged
314 Try
315 cmbClass2.Enabled = True
316 con = New SqlConnection(cs)
317 con.Open()
318 Dim ct As String = "SELECT distinct RTRIM(Class) FROM BusFeePayment_Student where Session=@d1"
319 cmd = New SqlCommand(ct)
320 cmd.Connection = con
321 cmd.Parameters.AddWithValue("@d1", cmbSession2.Text)
322 rdr = cmd.ExecuteReader()
323 cmbClass2.Items.Clear()
324 While rdr.Read
325 cmbClass2.Items.Add(rdr(0))
326 End While
327 con.Close()
328 Catch ex As Exception
329 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
330 End Try
331 End Sub
332
333 Private Sub TabControl1_Click(sender As System.Object, e As System.EventArgs) Handles TabControl1.Click
334 Reset()
335 End Sub
336
337 Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
338 Try
339 If Len(Trim(cmbSession1.Text)) = 0 Then
340 MessageBox.Show("Please select session", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
341 cmbSession1.Focus()
342 Exit Sub
343 End If
344 If Len(Trim(cmbClass1.Text)) = 0 Then
345 MessageBox.Show("Please select class", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
346 cmbClass1.Focus()
347 Exit Sub
348 End If
349 If Len(Trim(cmbInstallment.Text)) = 0 Then
350 MessageBox.Show("Please select installment", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
351 cmbInstallment.Focus()
352 Exit Sub
353 End If
354 con = New SqlConnection(cs)
355 con.Open()
356 cmd = New SqlCommand("SELECT RTRIM(Student.AdmissionNo),RTRIM(GRNo),RTRIM(StudentName),RTRIM(HostelName),RTRIM(SchoolName),RTRIM(PaymentDue) FROM HostelFeePayment,Student,Hosteler,HostelInfo,schoolInfo where Student.AdmissionNo=Hosteler.AdmissionNo and HostelInfo.HI_ID=Hosteler.HostelID and HostelFeePayment.HostelerID=Hosteler.H_ID and Student.SchoolID=SchoolInfo.S_ID and HostelFeePayment.Session=@d1 and HostelFeePayment.Class=@d2 and HostelFeePayment.Installment=@d3 and PaymentDue > 0 order by StudentName", con)
357 cmd.Parameters.AddWithValue("@d1", cmbSession1.Text)
358 cmd.Parameters.AddWithValue("@d2", cmbClass1.Text)
359 cmd.Parameters.AddWithValue("@d3", cmbInstallment.Text)
360 rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
361 dgw1.Rows.Clear()
362 While (rdr.Read() = True)
363 dgw1.Rows.Add(rdr(0), rdr(1), rdr(2), rdr(3), rdr(4), rdr(5))
364 End While
365 con.Close()
366 Catch ex As Exception
367 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
368 End Try
369 End Sub
370
371 Private Sub Button11_Click(sender As System.Object, e As System.EventArgs) Handles Button11.Click
372 Try
373 If Len(Trim(cmbSession2.Text)) = 0 Then
374 MessageBox.Show("Please select session", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
375 cmbSession2.Focus()
376 Exit Sub
377 End If
378 If Len(Trim(cmbClass2.Text)) = 0 Then
379 MessageBox.Show("Please select class", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
380 cmbClass2.Focus()
381 Exit Sub
382 End If
383 If Len(Trim(cmbInstallment1.Text)) = 0 Then
384 MessageBox.Show("Please select installment", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
385 cmbInstallment1.Focus()
386 Exit Sub
387 End If
388 con = New SqlConnection(cs)
389 con.Open()
390 cmd = New SqlCommand("SELECT RTRIM(Student.AdmissionNo),RTRIM(GRNo),RTRIM(StudentName),RTRIM(BusCardHolder_Student.Location),RTRIM(SchoolName),RTRIM(PaymentDue) FROM SchoolInfo INNER JOIN Student ON SchoolInfo.S_Id = Student.SchoolID INNER JOIN BusCardHolder_Student ON Student.AdmissionNo = BusCardHolder_Student.AdmissionNo INNER JOIN BusFeePayment_Student ON BusCardHolder_Student.BCH_Id = BusFeePayment_Student.BusHolderID where BusFeePayment_Student.Session=@d1 and BusFeePayment_Student.Class=@d2 and Installment=@d3 and PaymentDue > 0 order by StudentName", con)
391 cmd.Parameters.AddWithValue("@d1", cmbSession2.Text)
392 cmd.Parameters.AddWithValue("@d2", cmbClass2.Text)
393 cmd.Parameters.AddWithValue("@d3", cmbInstallment1.Text)
394 rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
395 dgw2.Rows.Clear()
396 While (rdr.Read() = True)
397 dgw2.Rows.Add(rdr(0), rdr(1), rdr(2), rdr(3), rdr(4), rdr(5))
398 End While
399 con.Close()
400 Catch ex As Exception
401 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
402 End Try
403 End Sub
404
405 Private Sub cmbClass1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbClass1.SelectedIndexChanged
406 Try
407 cmbInstallment.Enabled = True
408 con = New SqlConnection(cs)
409 con.Open()
410 Dim ct As String = "SELECT distinct RTRIM(Installment) FROM HostelFeePayment,Student,Hosteler,HostelInfo where Student.AdmissionNo=Hosteler.AdmissionNo and HostelInfo.HI_ID=Hosteler.HostelID and HostelFeePayment.HostelerID=Hosteler.H_ID and HostelFeePayment.Session=@d1 and HostelFeePayment.Class=@d2"
411 cmd = New SqlCommand(ct)
412 cmd.Connection = con
413 cmd.Parameters.AddWithValue("@d1", cmbSession1.Text)
414 cmd.Parameters.AddWithValue("@d2", cmbClass1.Text)
415 rdr = cmd.ExecuteReader()
416 cmbInstallment.Items.Clear()
417 While rdr.Read
418 cmbInstallment.Items.Add(rdr(0))
419 End While
420 con.Close()
421 Catch ex As Exception
422 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
423 End Try
424 End Sub
425
426 Private Sub cmbClass2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbClass2.SelectedIndexChanged
427 Try
428 cmbInstallment1.Enabled = True
429 con = New SqlConnection(cs)
430 con.Open()
431 Dim ct As String = "SELECT distinct RTRIM(Installment) FROM BusFeePayment_Student,Student,BusCardHolder_Student where Student.AdmissionNo=BusCardHolder_Student.AdmissionNo and BusFeePayment_Student.BusHolderID=BusCardHolder_Student.BCH_ID and BusFeePayment_Student.Session=@d1 and BusFeePayment_Student.Class=@d2"
432 cmd = New SqlCommand(ct)
433 cmd.Connection = con
434 cmd.Parameters.AddWithValue("@d1", cmbSession2.Text)
435 cmd.Parameters.AddWithValue("@d2", cmbClass2.Text)
436 rdr = cmd.ExecuteReader()
437 cmbInstallment1.Items.Clear()
438 While rdr.Read
439 cmbInstallment1.Items.Add(rdr(0))
440 End While
441 con.Close()
442 Catch ex As Exception
443 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
444 End Try
445 End Sub
446
447 Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
448 Try
449 If Len(Trim(cmbSession.Text)) = 0 Then
450 MessageBox.Show("Please select session", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
451 cmbSession.Focus()
452 Exit Sub
453 End If
454 If Len(Trim(cmbClass.Text)) = 0 Then
455 MessageBox.Show("Please select class", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
456 cmbClass.Focus()
457 Exit Sub
458 End If
459 If Len(Trim(cmbSemester.Text)) = 0 Then
460 MessageBox.Show("Please select semester", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
461 cmbSemester.Focus()
462 Exit Sub
463 End If
464 Cursor = Cursors.WaitCursor
465 Timer1.Enabled = True
466 Dim rpt As New rptClassFeePartialDue 'The report you created.
467 Dim myConnection As SqlConnection
468 Dim MyCommand As New SqlCommand()
469 Dim myDA As New SqlDataAdapter()
470 Dim myDS As New DataSet 'The DataSet you created.
471 myConnection = New SqlConnection(cs)
472 MyCommand.Connection = myConnection
473 MyCommand.CommandText = "SELECT SchoolInfo.S_Id, SchoolInfo.SchoolName, SchoolInfo.Address, SchoolInfo.ContactNo, SchoolInfo.AltContactNo, SchoolInfo.FaxNo, SchoolInfo.Email, SchoolInfo.Website, SchoolInfo.Logo, SchoolInfo.RegistrationNo,SchoolInfo.DiseNo, SchoolInfo.IndexNo, SchoolInfo.EstablishedYear, Student.AdmissionNo, Student.EnrollmentNo, Student.GRNo, Student.UID, Student.StudentName,Student.FatherName, Student.MotherName, Student.FatherCN, Student.PermanentAddress, Student.TemporaryAddress, Student.ContactNo AS Expr1, Student.EmailID, Student.DOB, Student.Gender,Student.AdmissionDate, Student.Caste, Student.Religion, Student.SectionID, Student.Photo, Student.Nationality, Student.SchoolID, Student.LastSchoolAttended, Student.Result,Student.PassPercentage, Student.Status, CourseFeePayment.Id, CourseFeePayment.CFP_ID, CourseFeePayment.PaymentID, CourseFeePayment.AdmissionNo AS Expr2, CourseFeePayment.Session , CourseFeePayment.Semester, CourseFeePayment.TotalFee, CourseFeePayment.DiscountPer, CourseFeePayment.DiscountAmt, CourseFeePayment.PreviousDue, CourseFeePayment.Fine,CourseFeePayment.GrandTotal, CourseFeePayment.TotalPaid, CourseFeePayment.ModeOfPayment, CourseFeePayment.PaymentModeDetails, CourseFeePayment.PaymentDate,CourseFeePayment.PaymentDue, CourseFeePayment.ClassType, CourseFeePayment.SchoolType AS Expr4, CourseFeePayment.Class , CourseFeePayment.Section FROM SchoolInfo INNER JOIN Student ON SchoolInfo.S_Id = Student.SchoolID INNER JOIN CourseFeePayment ON Student.AdmissionNo = CourseFeePayment.AdmissionNo where CourseFeePayment.Session=@d1 and CourseFeePayment.Class=@d2 and CourseFeePayment.Semester=@d3 and CourseFeePayment.PaymentDue > 0 order by Student.StudentName"
474 MyCommand.Parameters.AddWithValue("@d1", cmbSession.Text)
475 MyCommand.Parameters.AddWithValue("@d2", cmbClass.Text)
476 MyCommand.Parameters.AddWithValue("@d3", cmbSemester.Text)
477 MyCommand.CommandType = CommandType.Text
478 myDA.SelectCommand = MyCommand
479 myDA.Fill(myDS, "SchoolInfo")
480 myDA.Fill(myDS, "Student")
481 myDA.Fill(myDS, "CourseFeePayment")
482 rpt.SetDataSource(myDS)
483 frmReport.CrystalReportViewer1.ReportSource = rpt
484 frmReport.ShowDialog()
485 Catch ex As Exception
486 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
487 End Try
488 End Sub
489
490 Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
491 Cursor = Cursors.Default
492 Timer1.Enabled = False
493 End Sub
494
495 Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
496 Try
497 If Len(Trim(cmbSession1.Text)) = 0 Then
498 MessageBox.Show("Please select session", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
499 cmbSession1.Focus()
500 Exit Sub
501 End If
502 If Len(Trim(cmbClass1.Text)) = 0 Then
503 MessageBox.Show("Please select class", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
504 cmbClass1.Focus()
505 Exit Sub
506 End If
507 If Len(Trim(cmbInstallment.Text)) = 0 Then
508 MessageBox.Show("Please select installment", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
509 cmbInstallment.Focus()
510 Exit Sub
511 End If
512 Cursor = Cursors.WaitCursor
513 Timer1.Enabled = True
514 Dim rpt As New rptHostelFeePartialDue 'The report you created.
515 Dim myConnection As SqlConnection
516 Dim MyCommand As New SqlCommand()
517 Dim myDA As New SqlDataAdapter()
518 Dim myDS As New DataSet 'The DataSet you created.
519 myConnection = New SqlConnection(cs)
520 MyCommand.Connection = myConnection
521 MyCommand.CommandText = "SELECT SchoolInfo.S_Id, SchoolInfo.SchoolName, SchoolInfo.Address, SchoolInfo.ContactNo, SchoolInfo.AltContactNo, SchoolInfo.FaxNo, SchoolInfo.Email, SchoolInfo.Website, SchoolInfo.Logo, SchoolInfo.RegistrationNo,SchoolInfo.DiseNo, SchoolInfo.IndexNo, SchoolInfo.EstablishedYear, Student.AdmissionNo, Student.EnrollmentNo, Student.GRNo, Student.UID, Student.StudentName,Student.FatherName, Student.MotherName, Student.FatherCN, Student.PermanentAddress, Student.TemporaryAddress, Student.EmailID, Student.DOB, Student.Gender,Student.AdmissionDate, Student.Session, Student.Caste, Student.Religion, Student.SectionID, Student.Photo, Student.Nationality, Student.SchoolID, Student.LastSchoolAttended, Student.Result,Student.PassPercentage, Hosteler.H_Id, Hosteler.HostelID, Hosteler.JoiningDate, HostelFeePayment.Id, HostelFeePayment.HFP_Id,HostelFeePayment.PaymentID, HostelFeePayment.HostelerID, HostelFeePayment.Installment, HostelFeePayment.TotalFee, HostelFeePayment.DiscountPer,HostelFeePayment.DiscountAmt, HostelFeePayment.PreviousDue, HostelFeePayment.Fine, HostelFeePayment.GrandTotal, HostelFeePayment.TotalPaid, HostelFeePayment.ModeOfPayment,HostelFeePayment.PaymentModeDetails, HostelFeePayment.Paymentdate, HostelFeePayment.PaymentDue, HostelFeePayment.ClassType, HostelFeePayment.SchoolType, HostelFeePayment.Class , HostelFeePayment.Section, HostelInfo.HI_Id, HostelInfo.Hostelname, HostelInfo.ManagedBy,HostelInfo.Person_ContactNo FROM SchoolInfo INNER JOIN Student ON SchoolInfo.S_Id = Student.SchoolID INNER JOIN Hosteler ON Student.AdmissionNo = Hosteler.AdmissionNo INNER JOIN HostelFeePayment ON Hosteler.H_Id = HostelFeePayment.HostelerID INNER JOIN HostelInfo ON Hosteler.HostelID = HostelInfo.HI_Id where HostelFeePayment.Session=@d1 and HostelFeePayment.Class=@d2 and HostelFeePayment.Installment=@d3 and HostelFeePayment.PaymentDue > 0 order by Student.StudentName"
522 MyCommand.Parameters.AddWithValue("@d1", cmbSession1.Text)
523 MyCommand.Parameters.AddWithValue("@d2", cmbClass1.Text)
524 MyCommand.Parameters.AddWithValue("@d3", cmbInstallment.Text)
525 MyCommand.CommandType = CommandType.Text
526 myDA.SelectCommand = MyCommand
527 myDA.Fill(myDS, "Student")
528 myDA.Fill(myDS, "Hosteler")
529 myDA.Fill(myDS, "SchoolInfo")
530 myDA.Fill(myDS, "HostelFeePayment")
531 myDA.Fill(myDS, "HostelInfo")
532 rpt.SetDataSource(myDS)
533 frmReport.CrystalReportViewer1.ReportSource = rpt
534 frmReport.ShowDialog()
535 Catch ex As Exception
536 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
537 End Try
538 End Sub
539
540 Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles Button8.Click
541 Try
542 If Len(Trim(cmbSession2.Text)) = 0 Then
543 MessageBox.Show("Please select session", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
544 cmbSession2.Focus()
545 Exit Sub
546 End If
547 If Len(Trim(cmbClass2.Text)) = 0 Then
548 MessageBox.Show("Please select class", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
549 cmbClass2.Focus()
550 Exit Sub
551 End If
552 If Len(Trim(cmbInstallment1.Text)) = 0 Then
553 MessageBox.Show("Please select installment", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
554 cmbInstallment1.Focus()
555 Exit Sub
556 End If
557 Cursor = Cursors.WaitCursor
558 Timer1.Enabled = True
559 Dim rpt As New rptBusFeePartialDue_Student 'The report you created.
560 Dim myConnection As SqlConnection
561 Dim MyCommand As New SqlCommand()
562 Dim myDA As New SqlDataAdapter()
563 Dim myDS As New DataSet 'The DataSet you created.
564 myConnection = New SqlConnection(cs)
565 MyCommand.Connection = myConnection
566 MyCommand.CommandText = "SELECT SchoolInfo.S_Id, SchoolInfo.SchoolName, SchoolInfo.Address, SchoolInfo.ContactNo, SchoolInfo.AltContactNo, SchoolInfo.FaxNo, SchoolInfo.Email, SchoolInfo.Website, SchoolInfo.Logo, SchoolInfo.RegistrationNo,SchoolInfo.DiseNo, SchoolInfo.IndexNo, SchoolInfo.EstablishedYear, Student.AdmissionNo, Student.EnrollmentNo, Student.GRNo, Student.UID, Student.StudentName,Student.FatherName, Student.MotherName, Student.FatherCN, Student.PermanentAddress, Student.TemporaryAddress, Student.EmailID, Student.DOB, Student.Gender,Student.AdmissionDate, Student.Caste, Student.Religion, Student.SectionID, Student.Photo, Student.Nationality, Student.SchoolID, Student.LastSchoolAttended, Student.Result,Student.PassPercentage, Student.Status, BusCardHolder_Student.BCH_Id, BusCardHolder_Student.AdmissionNo AS Expr2, BusCardHolder_Student.BusNo, BusCardHolder_Student.Location,BusCardHolder_Student.JoiningDate, BusFeePayment_Student.Id, BusFeePayment_Student.BFP_ID, BusFeePayment_Student.PaymentID,BusFeePayment_Student.BusHolderID, BusFeePayment_Student.Session , BusFeePayment_Student.Installment, BusFeePayment_Student.TotalFee, BusFeePayment_Student.DiscountPer,BusFeePayment_Student.DiscountAmt, BusFeePayment_Student.PreviousDue, BusFeePayment_Student.Fine, BusFeePayment_Student.GrandTotal, BusFeePayment_Student.TotalPaid,BusFeePayment_Student.ModeOfPayment, BusFeePayment_Student.PaymentModeDetails, BusFeePayment_Student.PaymentDate, BusFeePayment_Student.PaymentDue, BusFeePayment_Student.ClassType,BusFeePayment_Student.SchoolType , BusFeePayment_Student.Class , BusFeePayment_Student.Section FROM SchoolInfo INNER JOIN Student ON SchoolInfo.S_Id = Student.SchoolID INNER JOIN BusCardHolder_Student ON Student.AdmissionNo = BusCardHolder_Student.AdmissionNo INNER JOIN BusFeePayment_Student ON BusCardHolder_Student.BCH_Id = BusFeePayment_Student.BusHolderID where BusFeePayment_Student.Session=@d1 and BusFeePayment_Student.Class=@d2 and Installment=@d3 and PaymentDue > 0 order by StudentName"
567 MyCommand.Parameters.AddWithValue("@d1", cmbSession2.Text)
568 MyCommand.Parameters.AddWithValue("@d2", cmbClass2.Text)
569 MyCommand.Parameters.AddWithValue("@d3", cmbInstallment1.Text)
570 MyCommand.CommandType = CommandType.Text
571 myDA.SelectCommand = MyCommand
572 myDA.Fill(myDS, "Student")
573 myDA.Fill(myDS, "BusCardHolder_Student")
574 myDA.Fill(myDS, "SchoolInfo")
575 myDA.Fill(myDS, "BusFeePayment_Student")
576 rpt.SetDataSource(myDS)
577 frmReport.CrystalReportViewer1.ReportSource = rpt
578 frmReport.ShowDialog()
579 Catch ex As Exception
580 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
581 End Try
582 End Sub
583 End Class